package com.spirng.leetcode.day07;

public class Test701 {
    public TreeNode insertIntoBST(TreeNode root, int val) {
        if(root==null){
            TreeNode treeNode = new TreeNode(val);
            return treeNode;
        }
        if (root.val>val){
            root.left=insertIntoBST(root.left,val);

        }
        if(root.val<val){
           root.right=insertIntoBST(root.right,val);
        }
        return root;
    }
}
